<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>获取可用的摘要算法</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.openssl-get-curve-names.html">« openssl_get_curve_names</a></li>
      <li style="float: right;"><a href="function.openssl-get-privatekey.html">openssl_get_privatekey »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.openssl.html">OpenSSL 函数</a></li>
    <li>获取可用的摘要算法</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.openssl-get-md-methods" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_get_md_methods</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">openssl_get_md_methods</span> &mdash; <span class="dc-title">获取可用的摘要算法</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-get-md-methods-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_get_md_methods</strong></span>(<span class="methodparam"><span class="type">bool</span> <code class="parameter">$aliases</code><span class="initializer"> = false</span></span>): <span class="type">array</span></div>

  <p class="para rdfs-comment">
   获取可用的摘要算法列表
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-get-md-methods-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">aliases</code></dt>

     <dd>

      <p class="para">
       设置为 <strong><code>true</code></strong> 时，返回的<span class="type">array</span>中将会包含摘要的别名.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-get-md-methods-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   含有可用摘要算法的<span class="type"><span class="type 数组">数组</span></span>
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.openssl-get-md-methods-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-941">
    <p><strong>示例 #1 <span class="function"><strong>openssl_get_md_methods()</strong></span> 范例：</strong></p>
    <div class="example-contents"><p>
     显示了可用的摘要，以及哪些别名可能是可用的。
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$digests&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">openssl_get_md_methods</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$digests_and_aliases&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">openssl_get_md_methods</span><span style="color: #007700">(</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$digest_aliases&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">array_diff</span><span style="color: #007700">(</span><span style="color: #0000BB">$digests_and_aliases</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$digests</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$digests</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$digest_aliases</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [0] =&gt; DSA
    [1] =&gt; DSA-SHA
    [2] =&gt; MD2
    [3] =&gt; MD4
    [4] =&gt; MD5
    [5] =&gt; RIPEMD160
    [6] =&gt; SHA
    [7] =&gt; SHA1
    [8] =&gt; SHA224
    [9] =&gt; SHA256
    [10] =&gt; SHA384
    [11] =&gt; SHA512
    [12] =&gt; dsaEncryption
    [13] =&gt; dsaWithSHA
    [14] =&gt; ecdsa-with-SHA1
    [15] =&gt; md2
    [16] =&gt; md4
    [17] =&gt; md5
    [18] =&gt; ripemd160
    [19] =&gt; sha
    [20] =&gt; sha1
    [21] =&gt; sha224
    [22] =&gt; sha256
    [23] =&gt; sha384
    [24] =&gt; sha512
)
Array
(
    [2] =&gt; DSA-SHA1
    [3] =&gt; DSA-SHA1-old
    [4] =&gt; DSS1
    [9] =&gt; RSA-MD2
    [10] =&gt; RSA-MD4
    [11] =&gt; RSA-MD5
    [12] =&gt; RSA-RIPEMD160
    [13] =&gt; RSA-SHA
    [14] =&gt; RSA-SHA1
    [15] =&gt; RSA-SHA1-2
    [16] =&gt; RSA-SHA224
    [17] =&gt; RSA-SHA256
    [18] =&gt; RSA-SHA384
    [19] =&gt; RSA-SHA512
    [28] =&gt; dsaWithSHA1
    [29] =&gt; dss1
    [32] =&gt; md2WithRSAEncryption
    [34] =&gt; md4WithRSAEncryption
    [36] =&gt; md5WithRSAEncryption
    [37] =&gt; ripemd
    [39] =&gt; ripemd160WithRSA
    [40] =&gt; rmd160
    [43] =&gt; sha1WithRSAEncryption
    [45] =&gt; sha224WithRSAEncryption
    [47] =&gt; sha256WithRSAEncryption
    [49] =&gt; sha384WithRSAEncryption
    [51] =&gt; sha512WithRSAEncryption
    [52] =&gt; shaWithRSAEncryption
    [53] =&gt; ssl2-md5
    [54] =&gt; ssl3-md5
    [55] =&gt; ssl3-sha1
)
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.openssl-get-md-methods-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.openssl-digest.html" class="function" rel="rdfs-seeAlso">openssl_digest()</a> - 计算摘要</span></li>
    <li class="member"><span class="function"><a href="function.openssl-get-cipher-methods.html" class="function" rel="rdfs-seeAlso">openssl_get_cipher_methods()</a> - 获取可用的加密算法</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>